{yun:}include file="$comstyle/header.htm"{/yun}
<div class="w1000">
  <div class="admin_mainbody"> {yun:}include file="$comstyle/left.htm"{/yun} 
<div class="com_tit"><span class="com_tit_span">优惠卡券</span> </div>
    <div class=right_box>
    <div class=admincont_box>
  
	<div class="com_body">
		{yun:}foreach from=$rows item=v{/yun}
		<div class="coupon_list">
			<div class="coupon_topbox">
				<div class="coupon_topbox_iconbg"><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i><i class="coupon_topbox_icon"></i></div>
				<div class="coupon_topbox_money">
					<div class="coupon_topbox_money_n">￥<span class="coupon_topbox_money_n_n">{yun:}$v.coupon_amount{/yun}</span></div>
					<div class="coupon_topbox_money_r">
					<div class="coupon_topbox_money_p">元优惠券</div>
					<div class="coupon_topbox_money_p">满 {yun:}$v.coupon_scope{/yun} 使用</div>
					</div>
				</div>
				<div class="coupon_topbox_p_box">
					<div class="coupon_topbox_p">使用时间：{yun:}$v.ctime|date_format:"%Y-%m-%d"{/yun} 至 {yun:}$v.validity|date_format:"%Y-%m-%d"{/yun}</div>
					<div class="coupon_topbox_p">优惠券码：{yun:}$v.number{/yun}</div>
					<div class="coupon_topbox_p"> {yun:}if $v.sourcename{/yun}此券由 {yun:}$v.sourcename{/yun}赠送</font> {yun:}/if{/yun}</div>
				</div>
			</div>
			<div class="coupon_botbox"><span class="coupon_botbox_xf">{yun:}if $v.status==2{/yun}<font color="green">已消费</font>{yun:}elseif $v.status==3{/yun}<font color="red">已到期</font>{yun:}else{/yun}未消费{yun:}/if{/yun}{yun:}$v.xf_time|date_format:"%Y-%m-%d"{/yun}</span>
			{yun:}if $v.status==1{/yun}
				{yun:}if $company.name{/yun}
				<a href="javascript:void(0)" onclick="handsel('{yun:}$v.id{/yun}')" class="coupon_botbox_zs">转送</a>
				{yun:}else{/yun}
				<a href="javascript:void(0)" onclick="layer.msg('请先完善基本信息！',2,8);return false;" class="coupon_botbox_zs">转送</a>
				{yun:}/if{/yun}
			{yun:}else{/yun}
				<a href="javascript:void(0)" onclick="layer_del('确定要删除？','index.php?c=coupon_list&act=del&id={yun:}$v.id{/yun}')" class="coupon_botbox_sc">删除</a>
			{yun:}/if{/yun}
			</div>
		</div>
		{yun:}foreachelse{/yun}
		<div class="msg_no">您还没有优惠券。</div>
		{yun:}/foreach{/yun}
		<div style="clear:both"></div>
		<div class="diggg">{yun:}$pagenav{/yun}</div>
	</div>
</div>
</div>
</div> 
<script> 
function handsel(id){ 
	$(".Blacklist_box>form>ul").html("");
	$("#username").val('');	
	$("#coupon").val(id);	
	$.layer({
		type : 1,
		title : '搜索企业',
		closeBtn : [0 , true], 
		border : [10 , 0.3 , '#000', true],
		area : ['400px','330px'],
		page : {dom : '#handsel'}
	});
}
function searchcomname(){
	var username=$.trim($("#username").val());
	if(username==''){
		
		layer.msg('请输入搜索的公司名！', 2, 8);return false;
	}else{
		var loadi = loadlayer();
		$.post("index.php?c=coupon_list&act=searchcomname",{username:username},function(data){
			layer.close(loadi);
			var data=eval('('+data+')');
			var html='';
			if(data && data.length>0){
				for (var i = 0; i < data.length; i++) {
					html+="<li class=\"cur\"><input class=\"re-company\" type=\"radio\" value=\""+data[i]['uid']+"\" name=\"buid\"><a href=\""+data[i]['comurl']+"\" target=\"_blank\">"+data[i]['name']+"</a></li>";
				}
			}else{
				html+="<li class=\"cur\">暂无符合条件企业</li>";
			}

			$(".Blacklist_box>form>ul").html(html);		
		});
	} 
}
function ckhandsel(){
	var uid = $("input[name='buid']:checked").val();  
	if(uid==''||uid==undefined){ 
		layer.msg("请选择要赠送的公司！",2,8);return false;
	} 
	layer.load('执行中，请稍候...',0); 
}
</script> 
<div style="padding:10px;height:260px; display:none;" id='handsel'>
    <input id="username" class="black_text" type="text" style="width:300px" placeholder="请输入公司名">
    <input type="button" value="搜索" class="black_sumit" onclick="searchcomname()">
    <div class="Blacklist_box">
        <iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe>
        <form action="index.php?c=coupon_list&act=save" target="supportiframe" method="post" onsubmit="return ckhandsel()">
            <div class="alert-compt-list_h1">请在下方选择您要赠送的公司</div>
            <ul></ul>
            <div class="black_submit_cont">
				<input name="coupon" type="hidden" id='coupon'>
                <input type="submit" value="确定" class="black_submit">
            </div>
        </form>
    </div>
    <div class="clear"></div>
</div>
</div>

{yun:}include file="$comstyle/footer.htm"{/yun} 